-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
src: fix use of uninitialized variable #9280
Conversation
Fix the following compiler warning: ../src/node_i18n.cc: In function 'void node::i18n::GetStringWidth( const v8::FunctionCallbackInfo<v8::Value>&)': ../src/node_i18n.cc:543:15: warning: 'c' may be used uninitialized in this function [-Wmaybe-uninitialized] if (!expand_emoji_sequence && ~~~~~~~~~~~~~~~~~~~~~~~~~ n > 0 && p == 0x200d && // 0x200d == ZWJ (zero width join Introduced in commit e8eaaa7 ("buffer: add buffer.transcode") from earlier today.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM but the commit message references the wrong commit (I think that should be 72547fe “readline: use icu based string width calculation”)
Aw, you're right. I'll fix that before landing, thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -519,14 +519,22 @@ static void GetStringWidth(const FunctionCallbackInfo<Value>& args) { | |||
} | |||
|
|||
TwoByteValue value(env->isolate(), args[0]); | |||
if (value.length() <= 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This additional shortcut is wrong. See the CI failures (https://ci.nodejs.org/job/node-test-commit-osx/5807/nodes=osx1010/console).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm about to go to bed so if you want to take this over, go ahead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 ... I just went ahead and created a new PR. I'll close this one in favor of that and we can follow up there. Thank you @bnoordhuis !
Closing in favor of #9281 |
R=@jasnell or @srl295?
CI: https://ci.nodejs.org/job/node-test-pull-request/4671/
EDIT: Make that https://ci.nodejs.org/job/node-test-pull-request/4672/ - I added a static_assert.